/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package InternetHax;

import javax.microedition.lcdui.Graphics;
/**
 *
 * @author LoginError
 */
public class FPSCounter {
int avgFPS;
int frameCount;
double lastTime;

public FPSCounter()
{
    lastTime = System.currentTimeMillis();
}


public void tick()
{
    frameCount++;
    double currentTime = System.currentTimeMillis();
    double delta = (currentTime - lastTime);
    if(delta >= 1000)
    {
        avgFPS +=frameCount;
        avgFPS /= 2;
        lastTime = currentTime;
        frameCount = 0;
    }

}

public void paint(Graphics g,int x, int y)
{
    Gamestate.font.PrintString(g, x, y, "FPS:"+avgFPS, 0, 0);
}



}



